<#
 #   It is recommended to test the script on a local machine for its purpose and effects. 
 #   ManageEngine Endpoint Central will not be responsible for any 
 #   damage/loss to the data/setup based on the behavior of the script.

 #   Description: Script is designed To Fetch List of the Files under the User Based folder via computer based deployment
 #   Configuration Type - COMPUTER
 #>

$name = (Get-WMIObject -ClassName Win32_ComputerSystem).Username
$username=$name.split("\")[1]

# Define the folder path (Script needs to be hardcoded here)
$folderPath = "C:\Users\$username\FolderName"

# Check if the folder exists
if (Test-Path $folderPath) {
    # Get list of files in the folder
    $files = Get-ChildItem -Path $folderPath

    if ($files) {
        Write-Host "Files in Downloads folder:"
        foreach ($file in $files) {
            Write-Host $file.Name
        }
    } else {
        Write-Host "No files found in Downloads folder."
    }
} else {
    Write-Host "Downloads folder not found."
}